package com.lr;

import com.lr.Service.INetservice;
import com.lr.dao.Product.ProductDao;
import com.lr.domain.INetSaler;
import com.lr.domain.Product;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext.xml")
public class main {

   @Autowired
   INetservice iNetservice;
   @Test
  public void test()
   {
       List<INetSaler> list= iNetservice.find_all();
       for(INetSaler iNetSaler: list)
       {
           System.out.println(iNetSaler);
       }
   }
    public static void main(String[] args)
    {
        /*ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        ProductDao productDao=(ProductDao) app.getBean("product");

        List<Product> list=productDao.ListProduct();
        for(Product product:list)
        {
         System.out.println(product.getId());
         System.out.println(product.getName());
         System.out.println(product.getPrice());
        }

        for(INetSaler iNetSaler: list)
        {
            System.out.println(iNetSaler);
        }
   ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");
        INetservice iNetservice=(INetservice) app.getBean("INetService");
       List<INetSaler> list= iNetservice.find_all();
        for(INetSaler iNetSaler: list)
        {
            System.out.println(iNetSaler);
        }*/
    }
}
